﻿//==============================================================================  
//Copyright (C) 2012-2015 9UN.ORG. All rights reserved. 
//GUID：b0c9b1dd-a31d-4b4a-bac7-f98fc02fa2dd
//CLR Version: 4.0.30319.18033
//Code Author：Kevin Wang
//Contact：Email(Admin@9un.org),QQ(265382 or 74344)
//Filename：LibVlcLogInterop
//Namespace：RuanRang.Media.Core.Internal.Interop
//Functions：LibVlcLogInterop  
//Created by Kevin Wang at 2013/3/3 15:02:14 http://blog.9un.org
//============================================================================== 

using System;
using System.Runtime.InteropServices;
using System.Security;
using RuanRang.Media.Core.Internal.DataStructures;
using log4net;

namespace RuanRang.Media.Core.Internal.Interop
{
    internal class LibVlcLoggingInterop : BaseInterop
    {
        /// <summary>
        ///     Initializes static members of the <see cref="LibVlcLoggingInterop" /> class.
        /// </summary>
        static LibVlcLoggingInterop()
        {
            Logger = LogManager.GetLogger(typeof (LibVlcLoggingInterop));
        }

        #region Logging

        /// <summary>
        ///     Libvlc_get_log_verbosity_unmanageds the specified libvlc_instance_t.
        /// </summary>
        /// <param name="libvlc_instance_t">The libvlc_instance_t.</param>
        /// <returns>UInt32.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_get_log_verbosity")]
        [SuppressUnmanagedCodeSecurity]
        private static extern UInt32 libvlc_get_log_verbosity_unmanaged(IntPtr libvlc_instance_t);

        /// <summary>
        ///     Libvlc_get_log_verbosities the specified libvlc_instance_t.
        /// </summary>
        /// <param name="libvlc_instance_t">The libvlc_instance_t.</param>
        /// <returns>UInt32.</returns>
        public static UInt32 libvlc_get_log_verbosity(IntPtr libvlc_instance_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_get_log_verbosity");
            }
            return libvlc_get_log_verbosity_unmanaged(libvlc_instance_t);
        }

        /// <summary>
        ///     Libvlc_set_log_verbosity_unmanageds the specified libvlc_instance_t.
        /// </summary>
        /// <param name="libvlc_instance_t">The libvlc_instance_t.</param>
        /// <param name="level">The level.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_set_log_verbosity")]
        [SuppressUnmanagedCodeSecurity]
        private static extern void libvlc_set_log_verbosity_unmanaged(IntPtr libvlc_instance_t, UInt32 level);

        /// <summary>
        ///     Libvlc_set_log_verbosities the specified libvlc_instance_t.
        /// </summary>
        /// <param name="libvlc_instance_t">The libvlc_instance_t.</param>
        /// <param name="level">The level.</param>
        public static void libvlc_set_log_verbosity(IntPtr libvlc_instance_t, UInt32 level)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_set_log_verbosity");
            }
            libvlc_set_log_verbosity_unmanaged(libvlc_instance_t, level);
        }

        /// <summary>
        ///     Libvlc_log_open_unmanageds the specified libvlc_instance_t.
        /// </summary>
        /// <param name="libvlc_instance_t">The libvlc_instance_t.</param>
        /// <returns>IntPtr.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_open")]
        [SuppressUnmanagedCodeSecurity]
        private static extern IntPtr libvlc_log_open_unmanaged(IntPtr libvlc_instance_t);

        /// <summary>
        ///     Libvlc_log_opens the specified libvlc_instance_t.
        /// </summary>
        /// <param name="libvlc_instance_t">The libvlc_instance_t.</param>
        /// <returns>IntPtr.</returns>
        public static IntPtr libvlc_log_open(IntPtr libvlc_instance_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_open");
            }
            return libvlc_log_open_unmanaged(libvlc_instance_t);
        }

        /// <summary>
        ///     Libvlc_log_close_unmanageds the specified libvlc_log_t.
        /// </summary>
        /// <param name="libvlc_log_t">The libvlc_log_t.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_close")]
        [SuppressUnmanagedCodeSecurity]
        private static extern void libvlc_log_close_unmanaged(IntPtr libvlc_log_t);

        public static void libvlc_log_close(IntPtr libvlc_log_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_close");
            }
            libvlc_log_close_unmanaged(libvlc_log_t);
        }

        /// <summary>
        ///     Libvlc_log_count_unmanageds the specified libvlc_log_t.
        /// </summary>
        /// <param name="libvlc_log_t">The libvlc_log_t.</param>
        /// <returns>UInt32.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_count")]
        [SuppressUnmanagedCodeSecurity]
        private static extern UInt32 libvlc_log_count_unmanaged(IntPtr libvlc_log_t);

        /// <summary>
        ///     Libvlc_log_counts the specified libvlc_log_t.
        /// </summary>
        /// <param name="libvlc_log_t">The libvlc_log_t.</param>
        /// <returns>UInt32.</returns>
        public static UInt32 libvlc_log_count(IntPtr libvlc_log_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_count");
            }
            return libvlc_log_count_unmanaged(libvlc_log_t);
        }

        /// <summary>
        ///     Libvlc_log_clear_unmanageds the specified libvlc_log_t.
        /// </summary>
        /// <param name="libvlc_log_t">The libvlc_log_t.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_clear")]
        [SuppressUnmanagedCodeSecurity]
        private static extern void libvlc_log_clear_unmanaged(IntPtr libvlc_log_t);

        /// <summary>
        ///     Libvlc_log_clears the specified libvlc_log_t.
        /// </summary>
        /// <param name="libvlc_log_t">The libvlc_log_t.</param>
        public static void libvlc_log_clear(IntPtr libvlc_log_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_clear");
            }
            libvlc_log_clear_unmanaged(libvlc_log_t);
        }

        /// <summary>
        ///     Libvlc_log_get_iterator_unmanageds the specified libvlc_log_t.
        /// </summary>
        /// <param name="libvlc_log_t">The libvlc_log_t.</param>
        /// <returns>IntPtr.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_get_iterator")]
        [SuppressUnmanagedCodeSecurity]
        private static extern IntPtr libvlc_log_get_iterator_unmanaged(IntPtr libvlc_log_t);

        /// <summary>
        ///     Libvlc_log_get_iterators the specified libvlc_log_t.
        /// </summary>
        /// <param name="libvlc_log_t">The libvlc_log_t.</param>
        /// <returns>IntPtr.</returns>
        public static IntPtr libvlc_log_get_iterator(IntPtr libvlc_log_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_get_iterator");
            }
            return libvlc_log_get_iterator_unmanaged(libvlc_log_t);
        }

        /// <summary>
        ///     Libvlc_log_iterator_free_unmanageds the specified libvlc_log_iterator_t.
        /// </summary>
        /// <param name="libvlc_log_iterator_t">The libvlc_log_iterator_t.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_iterator_free")]
        [SuppressUnmanagedCodeSecurity]
        private static extern void libvlc_log_iterator_free_unmanaged(IntPtr libvlc_log_iterator_t);

        /// <summary>
        ///     Libvlc_log_iterator_frees the specified libvlc_log_iterator_t.
        /// </summary>
        /// <param name="libvlc_log_iterator_t">The libvlc_log_iterator_t.</param>
        public static void libvlc_log_iterator_free(IntPtr libvlc_log_iterator_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_iterator_free");
            }
            libvlc_log_iterator_free_unmanaged(libvlc_log_iterator_t);
        }

        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_iterator_has_next")]
        [SuppressUnmanagedCodeSecurity]
        private static extern Int32 libvlc_log_iterator_has_next_unmanaged(IntPtr libvlc_log_iterator_t);

        /// <summary>
        ///     Libvlc_log_iterator_has_nexts the specified libvlc_log_iterator_t.
        /// </summary>
        /// <param name="libvlc_log_iterator_t">The libvlc_log_iterator_t.</param>
        /// <returns>Int32.</returns>
        public static Int32 libvlc_log_iterator_has_next(IntPtr libvlc_log_iterator_t)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_iterator_has_next");
            }
            return libvlc_log_iterator_has_next_unmanaged(libvlc_log_iterator_t);
        }

        /// <summary>
        ///     Libvlc_log_iterator_next_unmanageds the specified libvlc_log_iterator_t.
        /// </summary>
        /// <param name="libvlc_log_iterator_t">The libvlc_log_iterator_t.</param>
        /// <param name="p_buffer">The p_buffer.</param>
        /// <returns>IntPtr.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_log_iterator_next")]
        [SuppressUnmanagedCodeSecurity]
        private static extern IntPtr libvlc_log_iterator_next_unmanaged(IntPtr libvlc_log_iterator_t,
                                                                        ref libvlc_log_message_t p_buffer);

        /// <summary>
        ///     Libvlc_log_iterator_nexts the specified libvlc_log_iterator_t.
        /// </summary>
        /// <param name="libvlc_log_iterator_t">The libvlc_log_iterator_t.</param>
        /// <param name="p_buffer">The p_buffer.</param>
        /// <returns>IntPtr.</returns>
        public static IntPtr libvlc_log_iterator_next(IntPtr libvlc_log_iterator_t, ref libvlc_log_message_t p_buffer)
        {
            if (CallTraceEnabled)
            {
                TraceCall("libvlc_log_iterator_next");
            }
            return libvlc_log_iterator_next_unmanaged(libvlc_log_iterator_t, ref p_buffer);
        }

        #endregion
    }
}